<script lang="ts">
import KtTable from "/src/components/kantboot/components/KtTable/KtTable.vue";

export default {
  components: {KtTable},
  data() {
    return {
      columns: [
        {
          label: "ID",
          field: "id",
          type: "text",
          width: '300px',
          setting: {
            // 前缀
            prefix: '前缀',
            // 后缀
            suffix: '后缀',
          },
        },
        {
          label: "主图2",
          field: "img2",
          type: "img",
          width: '300px',
          setting: {
            type: 'id',
            width: '100px',
            height: '100px'
          },
          // 是否可编辑
          isEdit: true
        },
        {
          label: "价格",
          field: "price",
          type: "number",
          width: '300px',
          setting: {
            // 前缀
            prefix: '￥',
            // 算式
            formula: '*100',
          },
          // 是否可编辑
          isEdit: true
        },
        {
          label: "时间",
          field: "date",
          type: "button",
          width: '300px',
          buttonSetting: {
            type: 'button',
            clickEmit: 'clickCode'
          }
        },
        {
          label: "主图",
          field: "img",
          type: "img",
          width: '300px',
          setting: {
            type: 'url',
            width: '100px',
            height: '100px'
          },
          // 是否可编辑
          isEdit: true
        },

      ],
    }
  },
  mounted() {
    // this.$refs.ktTable.toEdit=(row)=>{
    //   alert(JSON.stringify(row))
    // }
  },
  methods: {
  }
}
</script>

<template>
  <div>
    <kt-table :columns="columns"
    ref="ktTable"
    ></kt-table>
  </div>
</template>

<style scoped>

</style>